package com.xkdx.guangguang;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.xkdx.caipiao.R;

public class WebViewShowActivity extends ManagerActivity{
	public static final String URL = "url";
//	public static final String TITLE = "title";
	private WebView mWebView;
	TextView textView;
	ImageView back_ico;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.activity_webview);
		
		mWebView = (WebView)findViewById(R.id.webview);
		Intent getIntent = getIntent();
		back_ico = (ImageView) findViewById(R.id.web_back_ico);
		textView = (TextView) findViewById(R.id.web_title_txt);
		back_ico.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		if(getIntent != null && !TextUtils.isEmpty(getIntent.getStringExtra(URL))){
			String url = getIntent.getStringExtra(URL);
			mWebView.getSettings().setJavaScriptEnabled(true);
			mWebView.setWebViewClient(new WebViewClient(){
				@Override
				public boolean shouldOverrideUrlLoading(WebView view, String url) {
					view.loadUrl(url);
					return true;
				}
			});
			mWebView.loadUrl(url);
			
		}else{
			Toast.makeText(this, "信息获取错误", Toast.LENGTH_SHORT).show();
			finish();
		}
	}

}
